const user = {
    name: 'Leslie',
    age: 18,
    gender: 'male'
}

const  getUserInfo = <T>(obj: T, prop: keyof T) => {
    return obj[prop]
}

getUserInfo(user,'name');